<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User_model extends CI_Model {

	public function get($user_id = NULL)
	{
		if($user_id == NULL)
		{
			return $this->db->get('users')->result_array();
		}
		else if(is_numeric($user_id))
		{
			return $this->db->where('id', $user_id)
							->get('users')
							->row_array();
		}
		else
		{
			return FALSE;
		}
	}

	public function get_by_email($email)
	{
		return $this->db->where('email', $email)
						->get('users')
						->row_array();
	}

	public function create($user_info)
	{	
		return $this->db->insert('users', $user_info);
	}
}